home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
byt85apr.lbr
/
EXAMPLES.LQR
/
EXAMPLE5.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-09-15
|
896b
|
42 lines
PROGRAM TEST1(INPUT, OUTPUT);
VAR
SUM,N,MAX,AVE:REAL;
COUNT,RAINY:INTEGER;
BEGIN
SUM:=0;
COUNT:=0;
RAINY :=0;
MAX :=0;
WRITELN('ENTER RAINFALL');
READLN;
READ(N);
WHILE N<>9999 DO
BEGIN
IF N<0 THEN
WRITELN(N:0:2,' IS NOT A POSSIBLE RAINFALL, TRY AGAIN')
ELSE
BEGIN
COUNT:=COUNT+1;
SUM:=SUM+1;
IF N>0 THEN
RAINY:=RAINY+1;
IF N>MAX THEN
N:=MAX;
END;
WRITELN('ENTER RAINFALL');
READLN;
READ(N)
END;
WRITELN;
IF COUNT=0 THEN
WRITELN(COUNT:0,' VALID RAINFALLS WERE ENTERED.')
ELSE
BEGIN
AVE:=SUM/COUNT;
WRITELN('THE AVERAGE RAINFALL WAS ',AVE:0:2,' INCHES PER DAY.');
WRITELN('THE HIGHEST RAINFALL WAS ',MAX:0:2,' INCHES.');
WRITELN('THERE WERE ',RAINY:0,' RAINY DAYS IN THIS PERIOD.')
END
END.